<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>页面修改</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript">
	var xmlHttp = null;
	function checkOptionName(obj) {
		var loginName = obj.value;
		console.log(loginName);
		if (loginName.length == 0) { //如果用户名为空 则 不发送请求
			return;
		}
		// 选择器                     实际的 url  和 参数 		
		$("#msg").load("patientAjax?bid=" + loginName,function(result){ 
			console.log(result+",,,");
			document.getElementById("msg").innerHTML = result;
		});
	}
</script>
<script type="text/javascript">
$(function(){
$("#sphone").blur(function(){
    /*  $.getJSON("testGetJSON.do"+param,function(result){
    	 console.log("result:::"+result);
        
     }); */
     var sname = $("#sname").val();
     var sphone = $("#sphone").val();
     var jsonArr = new Array();
     jsonArr[0] = sname;
     jsonArr[1] = sphone;
     
     console.log("sname:"+sname+",,,sphone"+sphone);
     console.log("===="+jsonArr[0]+",,"+jsonArr[1]);
     
    /*  $.ajax({
    		url:"ajaxSuffer.do?sname="+sname+"&sphone="+sphone,
    		type:"POST",
    		data:"data",
    		success:function(result){
    			console.log("====="+result);
    			if(result != null){
    				document.getElementById("spanId").innerHTML="1111111";
    			}
    		}
     }); */
     $.get("ajaxSuffer.do?sname="+sname+"&sphone="+sphone,
 			function(result){ 
    			 console.log("====="+result);
 				document.getElementById("spanId").innerHTML=result;
 			}
 		)
 });
});
</script>

<style type="text/css">
	#msg,#spanId{
		color:red; 
	}
</style>
</head>
<body>

	<div id="drugAlter">
		<h4>入住  页面</h4>
		<form class="form-horizontal" action="addPatient.do" method="post">
			<div class="form-group">
				<label for="sname" class="col-sm-2 control-label">姓名</label>
				<div class="col-sm-10">
					<input type="textarea" class="form-control" name="sname" 
						id="sname" placeholder="清输入姓名">
					
				</div>
				
			</div>
			<div class="form-group">
				<label for="sphone" class="col-sm-2 control-label">手机号</label>
				<div class="col-sm-10">
					<input type="test" class="form-control" name="sphone" id="sphone"
						placeholder="清输入手机号">
						<span id = "spanId"></span>
				</div>
			</div>
			<div class="form-group">
				<label for="ptext" class="col-sm-2 control-label">病症</label>
				<div class="col-sm-10">
					<input type="test" class="form-control" name="ptext" id="ptext" 
						placeholder="清输入病症">
				</div>
			</div>
	
			<div class="form-group">
				<label for="petYiMiao" class="col-sm-2 control-label">床位</label>
				<div class="col-sm-10" id="petYiMiao">
					
					<select name="bed.bid"  class="form-control" onchange="checkOptionName(this);">
						<option value="-1">请选择</option>
						<c:forEach items="${blist }" var="b" varStatus="status">
							<option  value="${b.bid }">${b.bname }</option>
						</c:forEach>
						<!-- <option value="-1">请选择</option>
						<option value="1">001</option>
						<option value="2">002</option>
						<option value="3">003</option>
						<option value="4">004</option>
						<option value="5">005</option>
						<option value="6">006</option>
						<option value="7">007</option>
						<option value="8">008</option>
						<option value="9">009</option>
						<option value="10">010</option>
						<option value="11">011</option> -->
						
						
					</select>
					<span id = "msg"></span>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-info">添加</button>
				</div>
			</div>
		</form>
	</div>
</body>
</html>